/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef OLA_CLOUD_COMMON_H
#define OLA_CLOUD_COMMON_H

#include "ola_coap_net.h"

#ifdef __cplusplus
extern "C" {
#endif

/*
 * 功能: 云端回应包检测
 * 参数：session，待检测session
 *       pkt，待检测的coap包
 * 返回: 0，成功
 *       非0，错误码
 */
int CloudResponseCoapCheck(const OlaCoapSession *session, const OlaCoapPacket *pkt);

/*
 * 功能: 云端回应errcode统一处理接口
 * 参数：payload，云端返回的数据
 * 返回: 0，errcode正常
 *       非0，errcode有异常
 */
int CloudResponseErrcodeHandler(const OlaData *payload);

/*
 * 功能: 网络检测模块初始化
 * 参数：interval，网络检测的间隔
 * 返回: 0，成功
 *       非0，错误码
 */
int CloudCheckNetworkInit(unsigned long long interval);

/*
 * 功能: 网络检测模块处理
 * 返回: 0，成功
 *       非0，错误码
 */
int CloudCheckNetworkProcess(void);

#ifdef __cplusplus
}
#endif

#endif /* OLA_CLOUD_COMMON_H */